Tool Context
Tool Context provides tools with access to the current execution environment. Instead of relying only on function parameters, a tool can read and update workflow variables, access runtime metadata, inspect execution state, and interact with the surrounding agent or workflow. This makes tools context-aware and enables more advanced automation scenarios.What is Tool Context?
A tool context contains information about the current execution. Typical information includes:- workflow variables
- execution metadata
- runtime state
- user input
- shared values
- workflow instance information
Why Use Tool Context?
Tool Context allows tools to:- access values created by previous nodes
- share information between tools
- read workflow state
- update execution variables
- participate in complex workflows
Execution Context
Internally, BindAI executes tools using an execution context.Reading Variables
Tools can read values stored in the context. Example:Writing Variables
Tools can also store new values.Sharing Data Between Tools
Example flow:Workflow Integration
When tools run inside workflows, they automatically participate in the workflow state. For example:Agent Integration
Agents also use the execution context. Typical values include:- current user input
- previous tool outputs
- structured results
- execution metadata
Example
Suppose a previous workflow node stored a customer identifier.Metadata
The execution context may also contain metadata. Typical examples include:- timestamps
- execution identifiers
- workflow IDs
- custom runtime information
Avoid Global State
Tool Context replaces global variables. Instead of:Context Lifetime
The context exists only for the current execution.Memory vs Context
Tool Context and Memory serve different purposes.
Use Tool Context for execution state and Memory for persistent knowledge about previous interactions.
Best Practices
- Use context for temporary execution data.
- Keep variable names descriptive.
- Store only information needed by later steps.
- Avoid large binary objects.
- Prefer context over global variables.
- Do not use context as permanent storage.
